package com.evenmo.string;

import com.sun.org.apache.xml.internal.utils.StringBufferPool;
import org.junit.Test;

public class StringBufferTest {
    @Test
    public void testStringBuffer(){
        StringBuffer sb=new StringBuffer();
        sb.append("this is StringBuffer string");
        sb.append("this is StringBuffer string");
        sb.append("this is StringBuffer string");
        sb.append("this is StringBuffer string");
        System.out.println(sb.length());
        System.out.println(sb.capacity());


        System.out.println(sb);
        sb.delete(27,38);
        System.out.println(sb.length());
        System.out.println(sb);

        sb.deleteCharAt(3);
        System.out.println(sb);
        sb.insert(3,'s');
        System.out.println(sb);


        sb=new StringBuffer("hello world");
        System.out.println(sb);
        sb.reverse();
        System.out.println(sb);
        System.out.println(sb.reverse());


    }
}
